package com.tywj.buscustomerapp.utils;

import android.util.Log;
import android.util.Xml;

import com.amap.api.maps.model.LatLng;
import com.tywj.buscustomerapp.Config;
import com.tywj.buscustomerapp.model.bean.ApplicationLineBean;
import com.tywj.buscustomerapp.model.bean.BuyedBean;
import com.tywj.buscustomerapp.model.bean.CityBean;
import com.tywj.buscustomerapp.model.bean.DaysBean;
import com.tywj.buscustomerapp.model.bean.DaysTicket;
import com.tywj.buscustomerapp.model.bean.MonthTicketBean;
import com.tywj.buscustomerapp.model.bean.MyTicketBean;
import com.tywj.buscustomerapp.model.bean.ProblemBean;
import com.tywj.buscustomerapp.model.bean.SearchUtilsBean;
import com.tywj.buscustomerapp.model.bean.StationBean;
import com.tywj.buscustomerapp.model.bean.TravelLineBean;
import com.tywj.buscustomerapp.model.bean.YuPiaoBean;

import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

public class WebServicrUtils {

    private static WebServicrUtils webServicrUtils = new WebServicrUtils();
    private static SoapObject rpc = null;
    private static SoapSerializationEnvelope envelope = null;
    private static HttpTransportSE ht = null;


    private static SoapObject rpc1 = null;
    private static SoapSerializationEnvelope envelope1 = null;
    private static HttpTransportSE ht1 = null;

    private static SoapObject rpc11 = null;
    private static SoapSerializationEnvelope envelope11 = null;
    private static HttpTransportSE ht11 = null;

    private static SoapObject rpc3 = null;
    private static SoapSerializationEnvelope envelope3 = null;
    private static HttpTransportSE ht3 = null;


    private static SoapObject rpc2 = null;
    private static SoapSerializationEnvelope envelope2 = null;
    private static HttpTransportSE ht2 = null;

    public static WebServicrUtils getInstance(){
        return  webServicrUtils;
    }


    public String getBusLocation(String lineNumber, String city) throws  IOException,XmlPullParserException{
        String WSDL_URI = Config.HTTPURL+"/soap/ITYWJAPP";//wsdl 的uri
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "getweizhi";//要调用的方法名称
        rpc2 = new SoapObject(namespace, methodName);
        // 生成调用Webservice方法的SOAP请求信息
        rpc2.addProperty("xl",lineNumber);
        rpc2.addProperty("chegnshi",city);
        envelope2 = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope2.dotNet = true;
        envelope2.setOutputSoapObject(rpc2);
        // 创建HttpTransportSE对象,通过HttpTransportSE类的构造方法可以指定WebService的url
        ht2 = new HttpTransportSE(WSDL_URI);
        // 使用call方法调用WebService方法
        ht2.call(null,envelope2);
        SoapObject object = (SoapObject) envelope2.bodyIn;
        Log.i("taylorLocation",object.getProperty(0).toString());
        return object.getProperty(0).toString();
    }

    /**
     * 获取线路购票情况
     * @param lineNumber
     * @return
     * @throws IOException
     * @throws XmlPullParserException
     */
    public String getDays(String lineNumber) throws  IOException,XmlPullParserException{
        String WSDL_URI = Config.HTTPURL+"/soap/ITYWJAPP";//wsdl 的uri
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "getsql";//要调用的方法名称
        rpc2 = new SoapObject(namespace, methodName);
        // 生成调用Webservice方法的SOAP请求信息
        rpc2.addProperty("xl",lineNumber);
        envelope2 = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope2.dotNet = true;
        envelope2.setOutputSoapObject(rpc2);
        // 创建HttpTransportSE对象,通过HttpTransportSE类的构造方法可以指定WebService的url
        ht2 = new HttpTransportSE(WSDL_URI);
        // 使用call方法调用WebService方法
        ht2.call(null,envelope2);
        SoapObject object = (SoapObject) envelope2.bodyIn;
        Log.i("taylorDays",object.getProperty(0).toString());
        return object.getProperty(0).toString();
    }

    /**
     * 获取已买车票
     * @param lineNumber
     * @return
     * @throws IOException
     * @throws XmlPullParserException
     */
    public String getBuyeds(String lineNumber,String phone) throws  IOException,XmlPullParserException{
        String WSDL_URI = Config.HTTPURL+"/soap/ITYWJAPP";//wsdl 的uri
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "getmaiguo";//要调用的方法名称
        rpc = new SoapObject(namespace, methodName);
        // 生成调用Webservice方法的SOAP请求信息
        rpc.addProperty("xl",lineNumber);
        rpc.addProperty("yhm",phone);
        envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(rpc);
        // 创建HttpTransportSE对象,通过HttpTransportSE类的构造方法可以指定WebService的url
        ht = new HttpTransportSE(WSDL_URI);
        // 使用call方法调用WebService方法
        ht.call(null,envelope);
        SoapObject object = (SoapObject) envelope.bodyIn;
//        Log.i("taylorBuys",object.getProperty(0).toString());
        return object.getProperty(0).toString();
    }

    /**
     * 购月票
     * @param start
     * @param end
     * @return
     * @throws IOException
     * @throws XmlPullParserException
     */
    public String buyMonthTicket(String phone, String lineNumber, String month, String year, String start, String end,
                                 String busNumber,String startTime,String endTime,String state) throws  IOException,XmlPullParserException{
        String WSDL_URI = Config.HTTPURL+"/soap/ITYWJAPP";//wsdl 的uri
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "yuepiaoinsert";//要调用的方法名称
        rpc = new SoapObject(namespace, methodName);
        // 生成调用Webservice方法的SOAP请求信息
        rpc.addProperty("yhm",phone);
        rpc.addProperty("gmxl",lineNumber);
        rpc.addProperty("gmyf",month);
        rpc.addProperty("gmnf",year);
        rpc.addProperty("gmqsz",start);
        rpc.addProperty("gmzdz",end);
        rpc.addProperty("CP",busNumber);
        rpc.addProperty("scsj",startTime);
        rpc.addProperty("xcsj",endTime);
        rpc.addProperty("ypzt",state);
        envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(rpc);
        // 创建HttpTransportSE对象,通过HttpTransportSE类的构造方法可以指定WebService的url
        ht = new HttpTransportSE(WSDL_URI);
        // 使用call方法调用WebService方法
        ht.call(null,envelope);
        SoapObject object = (SoapObject) envelope.bodyIn;
        return object.getProperty(0).toString();
    }
    /**
     * 是否可购月票
     * @param start
     * @param end
     * @return
     * @throws IOException
     * @throws XmlPullParserException
     */
    public String checkMonthTicket(String year, String month, String lineNumber, String start, String end) throws  IOException,XmlPullParserException{
        String WSDL_URI = Config.HTTPURL+"/soap/ITYWJAPP";//wsdl 的uri
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "checkyuepiaogoupiao";//要调用的方法名称
        rpc = new SoapObject(namespace, methodName);
        // 生成调用Webservice方法的SOAP请求信息
        rpc.addProperty("ccnf",year);
        rpc.addProperty("ccyf",month);
        rpc.addProperty("xl",lineNumber);
        rpc.addProperty("qsz",start);
        rpc.addProperty("zdz",end);
        envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(rpc);
        // 创建HttpTransportSE对象,通过HttpTransportSE类的构造方法可以指定WebService的url
        ht = new HttpTransportSE(WSDL_URI);
        // 使用call方法调用WebService方法
        ht.call(null,envelope);
        SoapObject object = (SoapObject) envelope.bodyIn;
//        Log.i("taylor",object.getProperty(0).toString());
        return object.getProperty(0).toString();
    }


    /**
     * 购票单次
     * @param start
     * @param end
     * @return
     * @throws IOException
     * @throws XmlPullParserException
     */
    public String doBuyTicketOnce(String phone, String lineNumber, String start, String end,
                                  String userStart, String userEnd, String busTime, String buyTIme,
                                  String price, String state, String city,String busNumber,
                                  String startTime,String endTime) throws  IOException,XmlPullParserException{
        String WSDL_URI = Config.HTTPURL+"/soap/ITYWJAPP";//wsdl 的uri
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "chepiaoinsert";//要调用的方法名称
        rpc = new SoapObject(namespace, methodName);
        // 生成调用Webservice方法的SOAP请求信息
        rpc.addProperty("yhm",phone);
        rpc.addProperty("ch",lineNumber);
        rpc.addProperty("qsz",start);
        rpc.addProperty("zdz",end);
        rpc.addProperty("gmqszId",userStart);
        rpc.addProperty("gmzdzId",userEnd);
        rpc.addProperty("ccsj",busTime);
        rpc.addProperty("gmsj",buyTIme);
        rpc.addProperty("pj",price);
        rpc.addProperty("ddzt",state);
        rpc.addProperty("cs",city);
        rpc.addProperty("CPH",busNumber);
        rpc.addProperty("scsj",startTime);
        rpc.addProperty("xcsj",endTime);
        envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(rpc);
        // 创建HttpTransportSE对象,通过HttpTransportSE类的构造方法可以指定WebService的url
        ht = new HttpTransportSE(WSDL_URI);
        // 使用call方法调用WebService方法
        ht.call(null,envelope);
        SoapObject object = (SoapObject) envelope.bodyIn;
//        Log.i("taylorTicketBuy",object.getProperty(0).toString());
        return object.getProperty(0).toString();
    }

    /**
     * 获取票价
     * @param lineId
     * @param start
     * @param end
     * @return
     * @throws IOException
     * @throws XmlPullParserException
     */
    public String getTicketPrice(String lineId, String start, String end) throws  IOException,XmlPullParserException{
        String WSDL_URI = Config.HTTPURL+"/soap/ITYWJAPP";//wsdl 的uri
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "piaojia";//要调用的方法名称
        rpc = new SoapObject(namespace, methodName);
        // 生成调用Webservice方法的SOAP请求信息
        rpc.addProperty("xianlu",lineId);
        rpc.addProperty("qsz",start);
        rpc.addProperty("zdz",end);
        envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(rpc);
        // 创建HttpTransportSE对象,通过HttpTransportSE类的构造方法可以指定WebService的url
        ht = new HttpTransportSE(WSDL_URI);
        // 使用call方法调用WebService方法
        ht.call(null,envelope);
        SoapObject object = (SoapObject) envelope.bodyIn;
        return object.getProperty(0).toString();
    }

    /**
     * 是否可购票
     * @param time
     * @param lineId
     * @param start
     * @param end
     * @return
     * @throws IOException
     * @throws XmlPullParserException
     */
    public String checkTicket(String time, String lineId, String start, String end) throws  IOException,XmlPullParserException{
        String WSDL_URI = Config.HTTPURL+"/soap/ITYWJAPP";//wsdl 的uri
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "checkgoupiao";//要调用的方法名称
        rpc = new SoapObject(namespace, methodName);
        // 生成调用Webservice方法的SOAP请求信息
        rpc.addProperty("ccrq",time);
        rpc.addProperty("xl",lineId);
        rpc.addProperty("qsz",start);
        rpc.addProperty("zdz",end);
        envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(rpc);
        // 创建HttpTransportSE对象,通过HttpTransportSE类的构造方法可以指定WebService的url
        ht = new HttpTransportSE(WSDL_URI);
        // 使用call方法调用WebService方法
        ht.call(null,envelope);
        SoapObject object = (SoapObject) envelope.bodyIn;
        Log.i("taylor111",object.getProperty(0).toString());
        return object.getProperty(0).toString();
    }

    /**
     * 库存
     * @param time
     * @param lineId
     * @param start
     * @param end
     * @return
     * @throws IOException
     * @throws XmlPullParserException
     */
    public String getCount(String time, String lineId, String start, String end) throws  IOException,XmlPullParserException{
        String WSDL_URI = Config.HTTPURL+"/soap/ITYWJAPP";//wsdl 的uri
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "getkucun";//要调用的方法名称
        rpc = new SoapObject(namespace, methodName);
        // 生成调用Webservice方法的SOAP请求信息
        rpc.addProperty("ccrq",time);
        rpc.addProperty("xl",lineId);
        rpc.addProperty("qsz",start);
        rpc.addProperty("zdz",end);
        envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(rpc);
        // 创建HttpTransportSE对象,通过HttpTransportSE类的构造方法可以指定WebService的url
        ht = new HttpTransportSE(WSDL_URI);
        // 使用call方法调用WebService方法
        ht.call(null,envelope);
        SoapObject object = (SoapObject) envelope.bodyIn;
        Log.i("taylor:getCount1",lineId+","+time+","+start+","+end);
        Log.i("taylor:getCount",object.getProperty(0).toString());
        return object.getProperty(0).toString();
    }


    /**
     * 获取活动列表
     * @return
     * @throws IOException
     * @throws XmlPullParserException
     */
    public String getActivity() throws  IOException,XmlPullParserException{
        String WSDL_URI = Config.HTTPURL+"/soap/ITYWJAPP";//wsdl 的uri
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "huodongzhongxin";//要调用的方法名称
        rpc = new SoapObject(namespace, methodName);
        // 生成调用Webservice方法的SOAP请求信息
        envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(rpc);
        // 创建HttpTransportSE对象,通过HttpTransportSE类的构造方法可以指定WebService的url
        ht = new HttpTransportSE(WSDL_URI);
        // 使用call方法调用WebService方法
        ht.call(null,envelope);
        SoapObject object = (SoapObject) envelope.bodyIn;
//        Log.i("taylor",object.getProperty(0).toString());
        return object.getProperty(0).toString();
    }

    /**
     * 路线申请
     * @param phone
     * @param home
     * @param work
     * @param time
     * @param time1
     * @return
     * @throws IOException
     * @throws XmlPullParserException
     */
    public String sendApplyLine(String phone,String home,String work,String time,String time1,
                                String cs, String qjingdu, String qweidu, String zjingdu, String zweidu) throws  IOException,XmlPullParserException{
        String WSDL_URI = Config.HTTPURL+"/soap/ITYWJAPP";//wsdl 的uri
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "xianlushenqinginsert";//要调用的方法名称
        rpc = new SoapObject(namespace, methodName);
        rpc.addProperty("yhm",phone);
        rpc.addProperty("jtzz",home);
        rpc.addProperty("gsdz",work);
        rpc.addProperty("sbsj",time);
        rpc.addProperty("xbsj",time1);
        rpc.addProperty("cs",cs);
        rpc.addProperty("qjingdu",qjingdu);
        rpc.addProperty("qweidu",qweidu);
        rpc.addProperty("zjingdu",zjingdu);
        rpc.addProperty("zweidu",zweidu);

        // 生成调用Webservice方法的SOAP请求信息
        envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(rpc);
        // 创建HttpTransportSE对象,通过HttpTransportSE类的构造方法可以指定WebService的url
        ht = new HttpTransportSE(WSDL_URI);
        // 使用call方法调用WebService方法
        ht.call(null,envelope);
        SoapObject object = (SoapObject) envelope.bodyIn;
        Log.i("taylor",object.getProperty(0).toString());
        return object.getProperty(0).toString();
    }



    /**
     * 获取申请线路
     * @param phone
     * @return
     * @throws IOException
     * @throws XmlPullParserException
     */
    public String getMyApplicationLine(String phone) throws  IOException,XmlPullParserException{
        String WSDL_URI = Config.HTTPURL+"/soap/ITYWJAPP";//wsdl 的uri
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "xianlushenqing";//要调用的方法名称
        rpc = new SoapObject(namespace, methodName);
        rpc.addProperty("yhm",phone);
        // 生成调用Webservice方法的SOAP请求信息
        envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(rpc);
        // 创建HttpTransportSE对象,通过HttpTransportSE类的构造方法可以指定WebService的url
        ht = new HttpTransportSE(WSDL_URI);
        // 使用call方法调用WebService方法
        ht.call(null,envelope);
        SoapObject object = (SoapObject) envelope.bodyIn;
        return object.getProperty(0).toString();
    }
    /**
     * 购买周期票
     * @return
     * @throws IOException
     * @throws XmlPullParserException
     */
    public String buyDaysTicket(String gmrq, String gmje, String dqrq, String cplx, String yhm, String cs, String qsrq) throws  IOException,XmlPullParserException{
        String WSDL_URI = Config.HTTPURL+"/soap/ITYWJAPP";//wsdl 的uri
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "zqchepiaoinsert";//要调用的方法名称
        rpc = new SoapObject(namespace, methodName);
        rpc.addProperty("gmrq",gmrq);
        rpc.addProperty("gmje",gmje);
        rpc.addProperty("dqrq",dqrq);
        rpc.addProperty("cpzt","未支付");
        rpc.addProperty("cplx",cplx);
        rpc.addProperty("yhm",yhm);
        rpc.addProperty("cs",cs);
        rpc.addProperty("qsrq",qsrq);
        // 生成调用Webservice方法的SOAP请求信息
        envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(rpc);
        // 创建HttpTransportSE对象,通过HttpTransportSE类的构造方法可以指定WebService的url
        ht = new HttpTransportSE(WSDL_URI);
        // 使用call方法调用WebService方法
        ht.call(null,envelope);
        SoapObject object = (SoapObject) envelope.bodyIn;
//        Log.i("taylordatsticket",object.getProperty(0).toString());
        return object.getProperty(0).toString();
    }


    /**
     * 获取我的月票
     * @param phone
     * @return
     * @throws IOException
     * @throws XmlPullParserException
     */
    public String getMyTravelMonth(String phone) throws  IOException,XmlPullParserException{
        String WSDL_URI = Config.HTTPURL+"/soap/ITYWJAPP";//wsdl 的uri
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "yuepiao";//要调用的方法名称
        rpc = new SoapObject(namespace, methodName);
        rpc.addProperty("yhm",phone);
        // 生成调用Webservice方法的SOAP请求信息
        envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(rpc);
        // 创建HttpTransportSE对象,通过HttpTransportSE类的构造方法可以指定WebService的url
        ht = new HttpTransportSE(WSDL_URI);
        // 使用call方法调用WebService方法
        ht.call(null,envelope);
        SoapObject object = (SoapObject) envelope.bodyIn;
        Log.i("taylormonthticket",object.getProperty(0).toString());
        return object.getProperty(0).toString();
    }

    public String getMyDays(String phone) throws  IOException,XmlPullParserException{
        String WSDL_URI = Config.HTTPURL+"/soap/ITYWJAPP";//wsdl 的uri
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "zqchepiao";//要调用的方法名称
        rpc = new SoapObject(namespace, methodName);
        rpc.addProperty("yhm",phone);
        // 生成调用Webservice方法的SOAP请求信息
        envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(rpc);
        // 创建HttpTransportSE对象,通过HttpTransportSE类的构造方法可以指定WebService的url
        ht = new HttpTransportSE(WSDL_URI);
        // 使用call方法调用WebService方法
        ht.call(null,envelope);
        SoapObject object = (SoapObject) envelope.bodyIn;
        Log.i("taylormonthticket",object.getProperty(0).toString());
        return object.getProperty(0).toString();
    }

    /**
     * 上车请求
     * @return
     * @throws IOException
     * @throws XmlPullParserException
     */
    public String doGoBus(String tickteId) throws  IOException,XmlPullParserException{
        String WSDL_URI = Config.HTTPURL+"/soap/ITYWJAPP";//wsdl 的uri
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "shangche";//要调用的方法名称
        rpc1 = new SoapObject(namespace, methodName);
        rpc1.addProperty("chepiaoid",tickteId);
        // 生成调用Webservice方法的SOAP请求信息
        envelope1 = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope1.dotNet = true;
        envelope1.setOutputSoapObject(rpc1);
        // 创建HttpTransportSE对象,通过HttpTransportSE类的构造方法可以指定WebService的url
        ht1 = new HttpTransportSE(WSDL_URI);
        // 使用call方法调用WebService方法
        ht1.call(null,envelope1);
        SoapObject object = (SoapObject) envelope1.bodyIn;
//        Log.i("taylorticket",object.getProperty(0).toString());
        if(object!=null && object.getProperty(0)!=null) {
            return object.getProperty(0).toString();
        }else{
            return null;
        }
    }

    /**
     * 获取车辆信息
     * @param lineName
     * @return
     * @throws IOException
     * @throws XmlPullParserException
     */
    public String getBusInfo(String lineName) throws  IOException,XmlPullParserException{
            String WSDL_URI = Config.HTTPURL+"/soap/ITYWJAPP";//wsdl 的uri
            String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
            String methodName = "cheliang";//要调用的方法名称
            rpc1 = new SoapObject(namespace, methodName);
            rpc1.addProperty("xlbh",lineName);
            // 生成调用Webservice方法的SOAP请求信息
            envelope1 = new SoapSerializationEnvelope(SoapEnvelope.VER11);
            envelope1.dotNet = true;
            envelope1.setOutputSoapObject(rpc1);
            // 创建HttpTransportSE对象,通过HttpTransportSE类的构造方法可以指定WebService的url
            ht1 = new HttpTransportSE(WSDL_URI);
            // 使用call方法调用WebService方法
            ht1.call(null,envelope1);
            SoapObject object = (SoapObject) envelope1.bodyIn;
            Log.i("taylorticket",object.getProperty(0).toString());
            return object.getProperty(0).toString();
    }

    /**
     * 获取我的线路
     * @param phone
     * @return
     * @throws IOException
     * @throws XmlPullParserException
     */
    public String getMyTravel(String phone) throws  IOException,XmlPullParserException{
        String WSDL_URI = Config.HTTPURL+"/soap/ITYWJAPP";//wsdl 的uri
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "chepiao";//要调用的方法名称
        rpc1 = new SoapObject(namespace, methodName);
        rpc1.addProperty("yhm",phone);
        // 生成调用Webservice方法的SOAP请求信息
        envelope1 = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope1.dotNet = true;
        envelope1.setOutputSoapObject(rpc1);
        // 创建HttpTransportSE对象,通过HttpTransportSE类的构造方法可以指定WebService的url
        ht1 = new HttpTransportSE(WSDL_URI);
        // 使用call方法调用WebService方法
        ht1.call(null,envelope1);
        SoapObject object = (SoapObject) envelope1.bodyIn;
        Log.i("taylorticket",object.getProperty(0).toString());
        return object.getProperty(0).toString();
    }

    /**
     * 提交反馈
     * @param phone
     * @param content
     * @param time
     * @return
     */
    public String postForBack(String phone,String content,String time) throws  IOException,XmlPullParserException{
        String WSDL_URI = Config.HTTPURL+"/soap/ITYWJAPP";//wsdl 的uri
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "zaixianfankuiinsert";//要调用的方法名称
        rpc = new SoapObject(namespace, methodName);
        rpc.addProperty("yhm",phone);
        rpc.addProperty("zxfk",content);
        rpc.addProperty("sj",time);
        // 生成调用Webservice方法的SOAP请求信息
        envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(rpc);
        // 创建HttpTransportSE对象,通过HttpTransportSE类的构造方法可以指定WebService的url
        ht = new HttpTransportSE(WSDL_URI);
        // 使用call方法调用WebService方法
        ht.call(null,envelope);
        SoapObject object = (SoapObject) envelope.bodyIn;
        return object.getProperty(0).toString();
    }


    public String postEva(String xl,String pj,String pjnr,String pjr) throws  IOException,XmlPullParserException{
        String WSDL_URI = Config.HTTPURL+"/soap/ITYWJAPP";//wsdl 的uri
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "fuwupingjia";//要调用的方法名称
        rpc = new SoapObject(namespace, methodName);
        rpc.addProperty("xl",xl);
        rpc.addProperty("pj",pj);
        rpc.addProperty("pjnr",pjnr);
        rpc.addProperty("pjr",pjr);
        // 生成调用Webservice方法的SOAP请求信息
        envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(rpc);
        // 创建HttpTransportSE对象,通过HttpTransportSE类的构造方法可以指定WebService的url
        ht = new HttpTransportSE(WSDL_URI);
        // 使用call方法调用WebService方法
        ht.call(null,envelope);
        SoapObject object = (SoapObject) envelope.bodyIn;
        return object.getProperty(0).toString();
    }

    public String postComp(String xl,String tsnr,String pjr) throws  IOException,XmlPullParserException{
        String WSDL_URI = Config.HTTPURL+"/soap/ITYWJAPP";//wsdl 的uri
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "tousu";//要调用的方法名称
        rpc = new SoapObject(namespace, methodName);
        rpc.addProperty("xl",xl);
        rpc.addProperty("tsnr",tsnr);
        rpc.addProperty("pjr",pjr);
        // 生成调用Webservice方法的SOAP请求信息
        envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(rpc);
        // 创建HttpTransportSE对象,通过HttpTransportSE类的构造方法可以指定WebService的url
        ht = new HttpTransportSE(WSDL_URI);
        // 使用call方法调用WebService方法
        ht.call(null,envelope);
        SoapObject object = (SoapObject) envelope.bodyIn;
        return object.getProperty(0).toString();
    }
    /**
     * 获取问题
     * @return
     * @throws IOException
     * @throws XmlPullParserException
     */
    public String getProblem() throws  IOException,XmlPullParserException{
        String WSDL_URI = Config.HTTPURL+"/soap/ITYWJAPP";//wsdl 的uri
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "changjianwenti";//要调用的方法名称
        rpc = new SoapObject(namespace, methodName);
        // 生成调用Webservice方法的SOAP请求信息
        envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(rpc);
        // 创建HttpTransportSE对象,通过HttpTransportSE类的构造方法可以指定WebService的url
        ht = new HttpTransportSE(WSDL_URI);
        // 使用call方法调用WebService方法
        ht.call(null,envelope);
        SoapObject object = (SoapObject) envelope.bodyIn;
        return object.getProperty(0).toString();
    }
    /**
     * 检查用户
     * @param phone
     * @return
     * @throws IOException
     * @throws XmlPullParserException
     */
    public String doCheckRegister(String phone) throws  IOException,XmlPullParserException{
        String WSDL_URI = Config.HTTPURL+"/soap/ITYWJAPP";//wsdl 的uri
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "checkuser";//要调用的方法名称
        rpc = new SoapObject(namespace, methodName);
        rpc.addProperty("tel",phone);
        // 生成调用Webservice方法的SOAP请求信息
        envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(rpc);
        // 创建HttpTransportSE对象,通过HttpTransportSE类的构造方法可以指定WebService的url
        ht = new HttpTransportSE(WSDL_URI);
        // 使用call方法调用WebService方法
        ht.call(null,envelope);
        SoapObject object = (SoapObject) envelope.bodyIn;
        return object.getProperty(0).toString();
    }

    /**
     * 注册
     * @param phone
     * @return
     * @throws IOException
     * @throws XmlPullParserException
     */
    public String doRegister(String phone,String code,String imei,String channelNumber) throws  IOException,XmlPullParserException{
        String WSDL_URI = Config.HTTPURL+"/soap/ITYWJAPP";//wsdl 的uri
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "ck_userinsert";//要调用的方法名称
        rpc = new SoapObject(namespace, methodName);
        rpc.addProperty("yhm",phone);
        rpc.addProperty("ma",code);
        rpc.addProperty("uid",imei);
        rpc.addProperty("qdh",channelNumber);
        // 生成调用Webservice方法的SOAP请求信息
        envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(rpc);
        // 创建HttpTransportSE对象,通过HttpTransportSE类的构造方法可以指定WebService的url
        ht = new HttpTransportSE(WSDL_URI);
        // 使用call方法调用WebService方法
        ht.call(null,envelope);
        SoapObject object = (SoapObject) envelope.bodyIn;
        return object.getProperty(0).toString();
    }

    /**
     * 用户更新
     * @param phone
     * @return
     * @throws IOException
     * @throws XmlPullParserException
     */
    public String doUpdata(String phone,String imei) throws  IOException,XmlPullParserException{
        String WSDL_URI = Config.HTTPURL+"/soap/ITYWJAPP";//wsdl 的uri
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "updateuser";//要调用的方法名称
        rpc = new SoapObject(namespace, methodName);
        rpc.addProperty("yhm",phone);
        rpc.addProperty("uid",imei);
        // 生成调用Webservice方法的SOAP请求信息
        envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(rpc);
        // 创建HttpTransportSE对象,通过HttpTransportSE类的构造方法可以指定WebService的url
        ht = new HttpTransportSE(WSDL_URI);
        // 使用call方法调用WebService方法
        ht.call(null,envelope);
        SoapObject object = (SoapObject) envelope.bodyIn;
        return object.getProperty(0).toString();
    }
    /**
     * 登陆
     * @param phone
     * @param pwd
     * @return
     * @throws IOException
     * @throws XmlPullParserException
     */
    public String doLogin(String phone,String pwd) throws  IOException,XmlPullParserException{
        String WSDL_URI = Config.HTTPURL+"/soap/ITYWJAPP";//wsdl 的uri
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "ck_user";//要调用的方法名称
        rpc = new SoapObject(namespace, methodName);
        rpc.addProperty("yhm",phone);
        rpc.addProperty("yhmm",pwd);
        // 生成调用Webservice方法的SOAP请求信息
        envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(rpc);
        // 创建HttpTransportSE对象,通过HttpTransportSE类的构造方法可以指定WebService的url
        ht = new HttpTransportSE(WSDL_URI);
        // 使用call方法调用WebService方法
        ht.call(null,envelope);
        SoapObject object = (SoapObject) envelope.bodyIn;
        return object.getProperty(0).toString();
    }

    /**
     * 登陆
     * @param phone
     * @param pwd
     * @return
     * @throws IOException
     * @throws XmlPullParserException
     */
    public String doChangePwd(String phone,String pwd) throws  IOException,XmlPullParserException{
        String WSDL_URI = Config.HTTPURL+"/soap/ITYWJAPP";//wsdl 的uri
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "ck_updatepsd";//要调用的方法名称
        rpc = new SoapObject(namespace, methodName);
        rpc.addProperty("yhm",phone);
        rpc.addProperty("yhmm",pwd);
        // 生成调用Webservice方法的SOAP请求信息
        envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(rpc);
        // 创建HttpTransportSE对象,通过HttpTransportSE类的构造方法可以指定WebService的url
        ht = new HttpTransportSE(WSDL_URI);
        // 使用call方法调用WebService方法
        ht.call(null,envelope);
        SoapObject object = (SoapObject) envelope.bodyIn;
        return object.getProperty(0).toString();
    }

    /**
     * 获取更新
     * @return
     * @throws IOException
     * @throws XmlPullParserException
     */
    public String getUpdateApp() throws IOException, XmlPullParserException {
        String WSDL_URI = Config.HTTPURL+"/soap/ITYWJAPP";//wsdl 的uri
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "version_Android_ck";//要调用的方法名称
        rpc = new SoapObject(namespace, methodName);
        // 生成调用Webservice方法的SOAP请求信息
        envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(rpc);
        // 创建HttpTransportSE对象,通过HttpTransportSE类的构造方法可以指定WebService的url
        ht = new HttpTransportSE(WSDL_URI);
        // 使用call方法调用WebService方法
        ht.call(null,envelope);
        SoapObject object = (SoapObject) envelope.bodyIn;
        Log.i("taylor",object.getProperty(0).toString());
        return object.getProperty(0).toString();
    }

    /**
     * 获取城市列表
     * @return
     * @throws IOException
     * @throws XmlPullParserException
     */
    public String getCityInWebService() throws IOException, XmlPullParserException {
        String WSDL_URI = Config.HTTPURL+"/soap/ITYWJAPP";//wsdl 的uri
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "chengshi";//要调用的方法名称
        rpc = new SoapObject(namespace, methodName);
        // 生成调用Webservice方法的SOAP请求信息
        envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(rpc);
        // 创建HttpTransportSE对象,通过HttpTransportSE类的构造方法可以指定WebService的url
        ht = new HttpTransportSE(WSDL_URI);
        // 使用call方法调用WebService方法
        ht.call(null,envelope);
        SoapObject object = (SoapObject) envelope.bodyIn;
//        Log.i("taylor",object.getProperty(0).toString());
        return object.getProperty(0).toString();
    }

    /**
     * 获取线路列表
     * @return
     * @throws IOException
     * @throws XmlPullParserException
     */
    public String getTravelLine(String cityId,String type) throws IOException,XmlPullParserException{
        String WSDL_RRL = Config.HTTPURL+"/soap/ITYWJAPP";
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "xianlubiao";
        rpc = new SoapObject(namespace,methodName);
        rpc.addProperty("csbh",cityId);
        rpc.addProperty("leibie",type);
        envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(rpc);
        ht = new HttpTransportSE(WSDL_RRL);
        ht.call(null,envelope);
        SoapObject object = (SoapObject) envelope.bodyIn;
        Log.i("taylor",object.getProperty(0).toString());
        return object.getProperty(0).toString();
    }

    public String getTravelLine2(String cityId,String type) throws IOException,XmlPullParserException{
        String WSDL_RRL = Config.HTTPURL+"/soap/ITYWJAPP";
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "xianlubiao";
        rpc1 = new SoapObject(namespace,methodName);
        rpc1.addProperty("csbh",cityId);
        rpc1.addProperty("leibie",type);
        envelope1 = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope1.dotNet = true;
        envelope1.setOutputSoapObject(rpc1);
        ht1 = new HttpTransportSE(WSDL_RRL);
        ht1.call(null,envelope1);
        SoapObject object = (SoapObject) envelope1.bodyIn;
//        Log.i("taylorLine",object.getProperty(0).toString());
        return object.getProperty(0).toString();
    }

    public String getCK(String cityId) throws IOException,XmlPullParserException{
        String WSDL_RRL = Config.HTTPURL+"/soap/ITYWJAPP";
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "kaleixing";
        rpc11 = new SoapObject(namespace,methodName);
        rpc11.addProperty("cs",cityId);
        envelope11 = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope11.dotNet = true;
        envelope11.setOutputSoapObject(rpc11);
        ht11 = new HttpTransportSE(WSDL_RRL);
        ht11.call(null,envelope11);
        SoapObject object = (SoapObject) envelope11.bodyIn;
//        Log.i("taylorLine",object.getProperty(0).toString());
        return object.getProperty(0).toString();
    }

    public String getTravelLine3(String cityId,String type) throws IOException,XmlPullParserException{
        String WSDL_RRL = Config.HTTPURL+"/soap/ITYWJAPP";
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "xianlubiao";
        rpc2 = new SoapObject(namespace,methodName);
        rpc2.addProperty("csbh",cityId);
        rpc2.addProperty("leibie",type);
        envelope2 = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope2.dotNet = true;
        envelope2.setOutputSoapObject(rpc2);
        ht2 = new HttpTransportSE(WSDL_RRL);
        ht2.call(null,envelope2);
        SoapObject object = (SoapObject) envelope2.bodyIn;
//        Log.i("taylorLine",object.getProperty(0).toString());
        return object.getProperty(0).toString();
    }

    public String getTravelLine4(String cityId,String type) throws IOException,XmlPullParserException{
        String WSDL_RRL = Config.HTTPURL+"/soap/ITYWJAPP";
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "xianlubiao";
        rpc3 = new SoapObject(namespace,methodName);
        rpc3.addProperty("csbh",cityId);
        rpc3.addProperty("leibie",type);
        envelope3 = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope3.dotNet = true;
        envelope3.setOutputSoapObject(rpc3);
        ht3 = new HttpTransportSE(WSDL_RRL);
        ht3.call(null,envelope3);
        SoapObject object = (SoapObject) envelope3.bodyIn;
//        Log.i("taylorLine",object.getProperty(0).toString());
        return object.getProperty(0).toString();
    }

    /**
     * 获取线路详情
     * @param xlbn
     * @return
     * @throws IOException
     * @throws XmlPullParserException
     */
    public String getTravelLineInfo(String xlbn) throws IOException,XmlPullParserException{
        String WSDL_RRL = Config.HTTPURL+"/soap/ITYWJAPP";
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "xianlubiaozibiao";
        rpc = new SoapObject(namespace,methodName);
        rpc.addProperty("xlbh",xlbn);
        envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(rpc);
        ht = new HttpTransportSE(WSDL_RRL);
        ht.call(null,envelope);
        SoapObject object = (SoapObject) envelope.bodyIn;
        return object.getProperty(0).toString();
    }

    /**
     * 搜索线路
     * @param xlbn
     * @return
     * @throws IOException
     * @throws XmlPullParserException
     */
    public String SearchTravelLineInfo(String xlbn) throws IOException,XmlPullParserException{
        String WSDL_RRL = Config.HTTPURL+"/soap/ITYWJAPP";
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "getduotiaoxianlu";
        rpc = new SoapObject(namespace,methodName);
        rpc.addProperty("xlbh",xlbn);
        envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(rpc);
        ht = new HttpTransportSE(WSDL_RRL);
        ht.call(null,envelope);
        SoapObject object = (SoapObject) envelope.bodyIn;
//        Log.i("taylorLine",object.getProperty(0).toString());
        return object.getProperty(0).toString();
    }

    /**
     * 获取所有站点信息
     * @return
     * @throws IOException
     * @throws XmlPullParserException
     */
    public String getAllStation(String cityId) throws IOException,XmlPullParserException{
        String WSDL_RRL = Config.HTTPURL+"/soap/ITYWJAPP";
        String namespace = "http://schemas.xmlsoap.org/wsdl/";//namespace
        String methodName = "getchezhan";
        rpc = new SoapObject(namespace,methodName);
        rpc.addProperty("csbh",cityId);
        envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(rpc);
        ht = new HttpTransportSE(WSDL_RRL);
        ht.call(null,envelope);
        SoapObject object = (SoapObject) envelope.bodyIn;
//        Log.i("taylorLine",object.getProperty(0).toString());
        return object.getProperty(0).toString();
    }

    public LatLng getBusLocation(InputStream inputStream) throws  Exception{
        LatLng latLng = null;
        XmlPullParser parser = Xml.newPullParser();
        parser.setInput(inputStream,"utf-8");
        int type = parser.getEventType();
        while (type!=XmlPullParser.END_DOCUMENT){
            switch (type) {
                //开始标签
                case XmlPullParser.START_TAG:
                    if ("weizhi".equals(parser.getName())) {
                        String message = parser.nextText();
                        String[] msgs = message.split(",");
                        double lat = Double.valueOf(msgs[2]);
                        double lon = Double.valueOf(msgs[1]);
                        latLng = new LatLng(lat,lon);
                    }
                    break;
                //结束标签
                case XmlPullParser.END_TAG:
                    break;
            }
            type = parser.next();
        }
        return latLng;
    }

    /**
     * 解析站点
     * @param inputStream
     * @return
     * @throws Exception
     */
    public List<StationBean> getStations(InputStream inputStream) throws  Exception{
        List<StationBean> stationBeans = null;
        StationBean station = null;
        XmlPullParser parser = Xml.newPullParser();
        parser.setInput(inputStream,"utf-8");
        int type = parser.getEventType();
        while (type!=XmlPullParser.END_DOCUMENT){
            switch (type) {
                //开始标签
                case XmlPullParser.START_TAG:
                    if ("xianlubiaozibiaoList".equals(parser.getName())) {
                        stationBeans = new ArrayList<>();
                    } else if ("xianlubiaozibiao".equals(parser.getName())) {
                        String message = parser.nextText();
                        String[] msgs = message.split(",");
                        station = new StationBean();
                        station.setId(msgs[0]);
                        station.setName(msgs[1]);
                        station.setLat(Double.valueOf(msgs[3]));
                        station.setLng(Double.valueOf(msgs[2]));
                        station.setTime(msgs[4]);
                        station.setStationId(msgs[5]);
                        if (msgs.length>7) {
                            station.setImg(Config.IMGURL + "/manage/img/" + msgs[7]);
                            if (msgs.length>8)
                                station.setInfo(msgs[8]);
                        }
                        stationBeans.add(station);
                    }
                    break;
                //结束标签
                case XmlPullParser.END_TAG:
                    break;
            }
            type = parser.next();
        }
        return stationBeans;
    }

    /**
     * 解析站点
     * @param inputStream
     * @return
     * @throws Exception
     */
    public List<SearchUtilsBean> getAddressStations(InputStream inputStream) throws  Exception{
        List<SearchUtilsBean> stationBeans = null;
        SearchUtilsBean station = null;
        XmlPullParser parser = Xml.newPullParser();
        parser.setInput(inputStream,"utf-8");
        int type = parser.getEventType();
        while (type!=XmlPullParser.END_DOCUMENT){
            switch (type) {
                //开始标签
                case XmlPullParser.START_TAG:
                    if ("chezhanList".equals(parser.getName())) {
                        stationBeans = new ArrayList<>();
                    } else if ("weizhi".equals(parser.getName())) {
                        String message = parser.nextText();
//                        Log.i("WEBSERVICER",message);
                        String[] msgs = message.split(",");
                        station = new SearchUtilsBean();
                        station.setLinNumber(msgs[0]);
                        station.setStationId(Integer.valueOf(msgs[1]));
                        station.setStationName(msgs[2]);
                        station.setLat(Double.valueOf(msgs[4]));
                        station.setLng(Double.valueOf(msgs[3]));
                        station.setTime(msgs[5]);
                        stationBeans.add(station);
                    }
                    break;
                //结束标签
                case XmlPullParser.END_TAG:
                    break;
            }
            type = parser.next();
        }
        return stationBeans;
    }

    /**
     * 解析线路列表
     * @param inStream
     * @return
     * @throws Exception
     */
    public List<TravelLineBean> getLines(InputStream inStream) throws  Exception{
        List<TravelLineBean> lines = null;
        TravelLineBean bean = null;
        XmlPullParser parser = Xml.newPullParser();
        ///初始化xmlPull解析器
        parser.setInput(inStream, "utf-8");
        //读取文件的类型
        int type = parser.getEventType();
        while (type!= XmlPullParser.END_DOCUMENT){
            switch (type) {
                //开始标签
                case XmlPullParser.START_TAG:
                    if ("xianlubiaoList".equals(parser.getName())) {
                        lines = new ArrayList<>();
                    } else if ("xianlubiao".equals(parser.getName())) {
                        String message = parser.nextText();
                        String[] msgs = message.split(",");
                        bean = new TravelLineBean();
                        bean.setNumber(msgs[0]);
                        bean.setName(msgs[1]);
                        bean.setStartLocation(msgs[2]);
                        bean.setEndLocation(msgs[3]);
                        bean.setPrice(msgs[7]);
                        bean.setStartTime(msgs[5]);
                        bean.setEndTime(msgs[6]);
                        bean.setIsUserAllPrice(msgs[8]);
                        bean.setState(msgs[10]);
                        bean.setBusNumber(msgs[9]);
                        if (msgs.length>12){
                            bean.setType(msgs[12]);
                        }
                        lines.add(bean);
                    }
                    break;
                //结束标签
                case XmlPullParser.END_TAG:
                    break;
            }
            //继续往下读取标签类型
            type = parser.next();
        }
        return lines;
    }


    public List<TravelLineBean> getLines1(InputStream inStream) throws  Exception{
        List<TravelLineBean> lines = null;
        TravelLineBean bean = null;
        DaysTicket daysTicket = null;
        XmlPullParser parser = Xml.newPullParser();
        ///初始化xmlPull解析器
        parser.setInput(inStream, "utf-8");
        //读取文件的类型
        int type = parser.getEventType();
        while (type!= XmlPullParser.END_DOCUMENT){
            switch (type) {
                //开始标签
                case XmlPullParser.START_TAG:
                    if ("kaleixingList".equals(parser.getName())) {
                        lines = new ArrayList<>();
                    } else if ("kaleixing".equals(parser.getName())) {
                        String message = parser.nextText();
                        String[] msgs = message.split(",");
                        bean = new TravelLineBean();
                        bean.isDaysTicket = true;
                        daysTicket = new DaysTicket();
                        daysTicket.setCityId(msgs[0]);
                        daysTicket.setName(msgs[1]);
                        daysTicket.setPrice(msgs[2]);
                        daysTicket.setId(msgs[3]);
                        daysTicket.setDays(msgs[4]);
                        bean.setDaysTicket(daysTicket);
                        lines.add(bean);
                    }
                    break;
                //结束标签
                case XmlPullParser.END_TAG:
                    break;
            }
            //继续往下读取标签类型
            type = parser.next();
        }
        return lines;
    }

    /**
     * 解析线路列表
     * @param inStream
     * @return
     * @throws Exception
     */
    public List<TravelLineBean> getLines2(InputStream inStream) throws  Exception{
        List<TravelLineBean> lines = null;
        TravelLineBean bean = null;
        XmlPullParser parser = Xml.newPullParser();
        ///初始化xmlPull解析器
        parser.setInput(inStream, "utf-8");
        //读取文件的类型
        int type = parser.getEventType();
        while (type!= XmlPullParser.END_DOCUMENT){
            switch (type) {
                //开始标签
                case XmlPullParser.START_TAG:
                    if ("xianluList".equals(parser.getName())) {
                        lines = new ArrayList<>();
                    } else if ("xlbh".equals(parser.getName())) {
                        String message = parser.nextText();
                        String[] msgs = message.split(",");
                        bean = new TravelLineBean();
                        bean.setNumber(msgs[0]);
                        bean.setName(msgs[1]);
                        bean.setStartLocation(msgs[2]);
                        bean.setEndLocation(msgs[3]);
                        bean.setPrice(msgs[7]);
                        bean.setStartTime(msgs[5]);
                        bean.setEndTime(msgs[6]);
                        bean.setIsUserAllPrice(msgs[8]);
                        bean.setState(msgs[10]);
                        bean.setBusNumber(msgs[9]);
                        lines.add(bean);
                    }
                    break;
                //结束标签
                case XmlPullParser.END_TAG:
                    break;
            }
            //继续往下读取标签类型
            type = parser.next();
        }
        return lines;
    }

    public List<ApplicationLineBean> getApplcationLine(InputStream inStream)
            throws Exception {
        List<ApplicationLineBean> list = null;
        //创建xmlPull解析器
        XmlPullParser parser = Xml.newPullParser();
        ///初始化xmlPull解析器
        parser.setInput(inStream, "utf-8");
        //读取文件的类型
        int type = parser.getEventType();
        //无限判断文件类型进行读取
        while (type != XmlPullParser.END_DOCUMENT) {
            switch (type) {
                //开始标签
                case XmlPullParser.START_TAG:
                    if ("xianlushenqingList".equals(parser.getName())) {
                        list = new ArrayList<>();
                    } else if ("xianlushenqing".equals(parser.getName())) {
                        ApplicationLineBean bean = new ApplicationLineBean();
                        String message = parser.nextText();
                        String[] msgs = message.split(",");
                        bean.setHome(msgs[1]);
                        bean.setWork(msgs[2]);
                        bean.setStartTime(msgs[3]);
                        bean.setEndTime(msgs[4]);
                        list.add(bean);
                    }
                    break;
                //结束标签
                case XmlPullParser.END_TAG:
                    break;
            }
            //继续往下读取标签类型
            type = parser.next();
        }
        return list;
    }

    public List<YuPiaoBean> getLineDays(InputStream inStream)
            throws Exception {
        List<YuPiaoBean> list = null;
        //创建xmlPull解析器
        XmlPullParser parser = Xml.newPullParser();
        ///初始化xmlPull解析器
        parser.setInput(inStream, "utf-8");
        //读取文件的类型
        int type = parser.getEventType();
        //无限判断文件类型进行读取
        while (type != XmlPullParser.END_DOCUMENT) {
            switch (type) {
                //开始标签
                case XmlPullParser.START_TAG:
                    if ("getsql".equals(parser.getName())) {
                        list = new ArrayList<>();
                    } else if ("yupiao".equals(parser.getName())) {
                        YuPiaoBean bean = new YuPiaoBean();
                        String message = parser.nextText();
                        String[] msgs = message.split(",");
                        bean.setBusTime(msgs[0]);
                        if (msgs.length>2 && msgs[2]!=null && !msgs[2].equals("")){
                            bean.setAllSeat(Integer.valueOf(msgs[2]));
                        }
                        if (msgs.length>3 && msgs[3]!=null && !msgs[3].equals("")){
                            bean.setYuPiao(Integer.valueOf(msgs[3]));
                        }
                        list.add(bean);
                    }
                    break;
                //结束标签
                case XmlPullParser.END_TAG:
                    break;
            }
            //继续往下读取标签类型
            type = parser.next();
        }
        return list;
    }

    public List<BuyedBean> getLineBuys(InputStream inStream)
            throws Exception {
        List<BuyedBean> list = null;
        //创建xmlPull解析器
        XmlPullParser parser = Xml.newPullParser();
        ///初始化xmlPull解析器
        parser.setInput(inStream, "utf-8");
        //读取文件的类型
        int type = parser.getEventType();
        //无限判断文件类型进行读取
        while (type != XmlPullParser.END_DOCUMENT) {
            switch (type) {
                //开始标签
                case XmlPullParser.START_TAG:
                    if ("getmaiguo".equals(parser.getName())) {
                        list = new ArrayList<>();
                    } else if ("maiguo".equals(parser.getName())) {
                        BuyedBean bean = new BuyedBean();
                        String message = parser.nextText();
                        String[] msgs = message.split(",");
                        if (msgs!=null && msgs.length>2){
                            bean.setPhone(msgs[0]);
                            bean.setLineNum(msgs[1]);
                            bean.setDay(msgs[2]);
                            list.add(bean);
                        }
                    }
                    break;
                //结束标签
                case XmlPullParser.END_TAG:
                    break;
            }
            //继续往下读取标签类型
            type = parser.next();
        }
        return list;
    }



    /**
     * 解析问题
     * @param inStream
     * @return
     * @throws Exception
     */
    public List<ProblemBean> getProblems(InputStream inStream)
            throws Exception {
        List<ProblemBean> list = null;
        //创建xmlPull解析器
        XmlPullParser parser = Xml.newPullParser();
        ///初始化xmlPull解析器
        parser.setInput(inStream, "utf-8");
        //读取文件的类型
        int type = parser.getEventType();
        //无限判断文件类型进行读取
        while (type != XmlPullParser.END_DOCUMENT) {
            switch (type) {
                //开始标签
                case XmlPullParser.START_TAG:
                    if ("changjianwentiList".equals(parser.getName())) {
                        list = new ArrayList<>();
                    } else if ("changjianwenti".equals(parser.getName())) {
                        ProblemBean bean = new ProblemBean();
                        bean.setQuestion(parser.getAttributeValue(null,"wtmc"));
                        bean.setAnswer(parser.nextText());
                        list.add(bean);
                    }
                    break;
                //结束标签
                case XmlPullParser.END_TAG:
                    break;
            }
            //继续往下读取标签类型
            type = parser.next();
        }
        return list;
    }

    public List<DaysBean> getMyDaysTicket(InputStream inStream)
            throws Exception {
        List<DaysBean> list = null;
        //创建xmlPull解析器
        XmlPullParser parser = Xml.newPullParser();
        ///初始化xmlPull解析器
        parser.setInput(inStream, "utf-8");
        //读取文件的类型
        int type = parser.getEventType();
        //无限判断文件类型进行读取
        while (type != XmlPullParser.END_DOCUMENT) {
            switch (type) {
                //开始标签
                case XmlPullParser.START_TAG:
                    if ("zqchepiaoList".equals(parser.getName())) {
                        list = new ArrayList<>();
                    } else if ("zqchepiao".equals(parser.getName())) {
                        DaysBean bean = new DaysBean();
                        String message = parser.nextText();
                        String[] msgs = message.split(",");
                        bean.setBuyTime(msgs[1]);
                        bean.setPrice(msgs[2]);
                        bean.setDqsj(msgs[3]);
                        bean.setCityName(msgs[8]);
                        bean.setKssj(msgs[9]);
                        bean.setState(msgs[4]);
                        list.add(bean);
                    }
                    break;
                //结束标签
                case XmlPullParser.END_TAG:
                    break;
            }
            //继续往下读取标签类型
            type = parser.next();
        }
        return list;
    }

    /**
     * 我的月票
     * @param inStream
     * @return
     * @throws Exception
     */
    public List<MonthTicketBean> getMyMonthTicket(InputStream inStream)
            throws Exception {
        List<MonthTicketBean> list = null;
        //创建xmlPull解析器
        XmlPullParser parser = Xml.newPullParser();
        ///初始化xmlPull解析器
        parser.setInput(inStream, "utf-8");
        //读取文件的类型
        int type = parser.getEventType();
        //无限判断文件类型进行读取
        while (type != XmlPullParser.END_DOCUMENT) {
            switch (type) {
                //开始标签
                case XmlPullParser.START_TAG:
                    if ("yuepiaoList".equals(parser.getName())) {
                        list = new ArrayList<>();
                    } else if ("yuepiao".equals(parser.getName())) {
                        MonthTicketBean bean = new MonthTicketBean();
                        String message = parser.nextText();
                        String[] msgs = message.split(",");
                        bean.setLineNumber(msgs[1]);
                        bean.setMonth(msgs[2]);
                        bean.setYear(msgs[3]);
                        if (msgs.length>4) {
                            bean.setStart(msgs[4]);
                            bean.setEnd(msgs[5]);
                            bean.setBusNumber(msgs[6]);
                            bean.setStartTime(msgs[7]);
                            bean.setEndTime(msgs[8]);
                            bean.setState(msgs[9]);
                            bean.setId(msgs[10]);
                        }
                        list.add(bean);
                    }
                    break;
                //结束标签
                case XmlPullParser.END_TAG:
                    break;
            }
            //继续往下读取标签类型
            type = parser.next();
        }
        return list;
    }

    /**
     * 我的线路单票
     * @param inStream
     * @return
     * @throws Exception
     */
    public List<MyTicketBean> getMyTicket(InputStream inStream)
            throws Exception {
        List<MyTicketBean> list = null;
        //创建xmlPull解析器
        XmlPullParser parser = Xml.newPullParser();
        ///初始化xmlPull解析器
        parser.setInput(inStream, "utf-8");
        //读取文件的类型
        int type = parser.getEventType();
        //无限判断文件类型进行读取
        while (type != XmlPullParser.END_DOCUMENT) {
            switch (type) {
                //开始标签
                case XmlPullParser.START_TAG:
                    if ("chepiaoList".equals(parser.getName())) {
                        list = new ArrayList<>();
                    } else if ("chepiao".equals(parser.getName())) {
                        MyTicketBean bean = new MyTicketBean();
                        String message = parser.nextText();
                        String[] msgs = message.split(",");
                        bean.setTravelNum(msgs[1]);
                        bean.setTravelStart(msgs[2]);
                        bean.setTravelEnd(msgs[3]);
                        bean.setMyStart(msgs[4]);
                        bean.setMyEnd(msgs[5]);
                        bean.setTime(msgs[6]);
                        bean.setBusTime(msgs[7]);
                        bean.setPrice(msgs[8]);
                        bean.setState(msgs[9]);
                        bean.setId(msgs[10]);
                        bean.setBusNumber(msgs[11]);
                        bean.setMyStartTime(msgs[12]);
                        bean.setMyEndTime(msgs[13]);
                        bean.setCityId(msgs[14]);
                        if (msgs.length>15){
                            bean.setTravelName(msgs[15]);
                        }
                        list.add(bean);
                    }
                    break;
                //结束标签
                case XmlPullParser.END_TAG:
                    break;
            }
            //继续往下读取标签类型
            type = parser.next();
        }
        return list;
    }


    /**
     * 解析城市列表
     * @param inStream
     * @return
     * @throws Exception
     */
    public List<CityBean> getCitys(InputStream inStream)
            throws Exception {
        List<CityBean> list = null;
        CityBean city = null;
        //创建xmlPull解析器
        XmlPullParser parser = Xml.newPullParser();
        ///初始化xmlPull解析器
        parser.setInput(inStream, "utf-8");
        //读取文件的类型
        int type = parser.getEventType();
        //无限判断文件类型进行读取
        while (type != XmlPullParser.END_DOCUMENT) {
            switch (type) {
                //开始标签
                case XmlPullParser.START_TAG:
                    if ("chengshiList".equals(parser.getName())) {
                        list = new ArrayList<>();
                    } else if ("chengshi".equals(parser.getName())) {
                        city = new CityBean();
                        String message = parser.nextText();
                        String[] msgs = message.split(",");
                        city.setCityName(msgs[1]);
                        city.setCityId(msgs[0]);
                        list.add(city);
                    }
                    break;
                //结束标签
                case XmlPullParser.END_TAG:
                    break;
            }
            //继续往下读取标签类型
            type = parser.next();
        }
        return list;
    }

    /**
     * 解析活动列表
     * @return
     * @throws Exception
     */
    public List<ProblemBean> getActivitys()
            throws Exception {
        String msg = WebServicrUtils.getInstance().getActivity();
        Log.i("taylor",msg);
        InputStream inStream = new ByteArrayInputStream(msg.getBytes("UTF-8"));
        List<ProblemBean> list = null;
        //创建xmlPull解析器
        XmlPullParser parser = Xml.newPullParser();
        ///初始化xmlPull解析器
        parser.setInput(inStream, "utf-8");
        //读取文件的类型
        int type = parser.getEventType();
        //无限判断文件类型进行读取
        while (type != XmlPullParser.END_DOCUMENT) {
            switch (type) {
                //开始标签
                case XmlPullParser.START_TAG:
                    if ("huodongzhongxinList".equals(parser.getName())) {
                        list = new ArrayList<>();
                    } else if ("huodongzhongxin".equals(parser.getName())) {
                        String title = parser.getAttributeValue(null,"hdmc");
                        //获取name值
                        String content[] = parser.nextText().split(",");
                        ProblemBean bean  = new ProblemBean();
                        bean.setQuestion(title);
                        bean.setAnswer(content[1]);
                        if (content.length>4) {
                            bean.setIsSend(Integer.valueOf(content[2]));
                            bean.setImg(content[3]);
                            bean.setSmImg(content[4]);
                        }
                        list.add(bean);
                    }
                    break;
                //结束标签
                case XmlPullParser.END_TAG:
                    break;
            }
            //继续往下读取标签类型
            type = parser.next();
        }
        return list;
    }
}
